using MediatR;
using MES.Server.API.Application.Command.ApprovalProcess;
using Microsoft.AspNetCore.Mvc;
using ReturnValue;
using System.Threading.Tasks;

namespace ERP.Server.API.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class PurchaseOrderController : ControllerBase
    {
        private readonly IMediator _mediator;

        public PurchaseOrderController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 审批采购单
        /// </summary>
        /// <param name="command">审批命令</param>
        /// <returns>审批结果</returns>
        [HttpPost("approval")]
        public async Task<ApiResult<bool>> ApprovalPurchaseOrder([FromBody] ApprovalPurchaseOrderCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
